<?$numCss=12;
if (strpos($_SERVER['HTTP_USER_AGENT'], "MSIE 7")!==FALSE)
    $ie = 7;
else if (strpos($_SERVER['HTTP_USER_AGENT'], "MSIE 8")!==FALSE)
    $ie = 8;
else
    $ie=-1;

echo $this->doctype(); ?>
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <?= $this->headMeta(); ?>
        <? $this->headTitle()->setPrefix('foofind.com');
        echo $this->headTitle();?>
        <?  $this->headLink()->appendStylesheet(STATIC_PATH . '/css/main.css?numCss=' . $numCss);
           if ($ie==7) $this->headLink()->appendStylesheet(STATIC_PATH . '/css/ie7.css?numCss=' . $numCss);
           else if ($ie==8)  $this->headLink()->appendStylesheet(STATIC_PATH . '/css/ie8.css?numCss=' . $numCss);

        foreach (Zend_Registry::get("languages") as $lang=>$name) {
            if ($this->lang == $lang) continue;
            $href = $_SERVER['SCRIPT_URI'];
            if (strstr($href, "/{$this->lang}/"))
                $href = str_replace("/{$this->lang}/", "/$lang/", $href);
            else
                $href .= "$lang/";
            $this->headLink(array('rel' => 'alternate', 'hreflang' => $lang, 'href' => $href), 'APPEND');
        }
        ?>
        <?=$this->headLink(); ?>
        <link rel="shortcut icon" href="<?= STATIC_PATH ?>/images/favicon.ico" />
        <link rel="search" type="application/opensearchdescription+xml" href="/opensearch_<?= $this->lang ?>.xml" title="Foofind" />
        <?= $this->jQuery()->setLocalPath(STATIC_PATH . '/js/jquery.min.js'); ?>
        <?= $this->headScript(); ?>
        <? if ($ie>0): ?><script type="text/javascript">$(window).load(function() { corners('.awesome', '/images/alert-overlay.png'); });</script><? endif; ?>
        <script type="text/javascript">if (window != top) top.location.href = location.href;</script>
        <script type="text/javascript">var _gaq = _gaq || [];_gaq.push(['_setAccount', 'UA-808946-19']);_gaq.push(['_setDomainName', '.foofind.com']);_gaq.push(['_trackPageview']);(function() {var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);})();</script>
    </head>
    <body>
        <?if ($this->langtest):?><div id="beta_translation"><?=$this->translate("BetaTranslation", "/{$this->lang}/page/translate/?lang={$this->lang}")?></div><?endif;?>
        <div id="header" >
            <div id="header-navigation" >
                <span class="user_login_box">
                    <?php
                    $auth = Zend_Auth::getInstance ();
                    if (!$auth->hasIdentity()) {
                        echo '<a href="/' . $this->lang . '/user/register">' . $this->translate('new user') . '</a> ' .
                        $this->translate('or') . ' ';
                        echo '<a href="/' . $this->lang . '/auth/login">' . $this->translate('login') . '</a>';
                    } else {
                        $auth_username = $auth->getIdentity()->username;
                        $auth_userid = $auth->getIdentity()->IdUser;
                        echo $this->translate('hello,') . '<b>&nbsp;<a href="/' .
                        $this->lang . '/profile/' . $this->escape($auth_username) . '">' . $this->escape($auth_username) . '</a></b> | ' . '<a href="/' . $this->lang . '/auth/logout">' .
                        $this->translate('logout') . '</a>';
                    } ?></span>&nbsp;&nbsp;
                <div id="select_language_box">
                    <?php
                    $langs = Zend_Registry::get("languages");
                    $testlangs = Zend_Registry::get("testlangs");
                    foreach ($langs as $lang=>$name):
                        $langlink = "/$lang/index/setlang";
                        if ($testlangs[$lang]==1) {
                            $beta = "<div class='beta_lang'></div>"; 
                            if ($this->lang==$lang) $langlink = "/$lang/page/translate?lang=$lang";
                        } else
                            $beta = "";
                        ?>
                        <a class="lang<?=($this->lang==$lang)?" active":""?>" href='<?=$langlink?>'><div class="flag <?=$lang?>"></div><span><?=$name?></span><?=$beta?></a>
                    <?php endforeach;?>
                    <a href='/<?=$this->lang?>/page/translate'><?=$this->translate('Other');?>...</a>
                </div>
            </div>
        </div>
